﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using XStudio.XCRF.Data.Entities.CureInfo;
using XStudio.XCRF.Data;

namespace XStudio.XCRF.Web.Models.CureInfo
{
    public class DiseaseInfo
    {
        private static IEnumerable<Disease> _Diseases;
        public static IEnumerable<Disease> Diseases
        {
            get
            {
                if (_Diseases == null)
                {
                    using (XCRFContext context = new XCRFContext())
                    {
                        List<Disease> diseases = context.Diseases.ToList();
                        Disease otherDisease = diseases.Single(d => d.Name == "其他");
                        diseases.Remove(otherDisease);
                        //diseases.Add(otherDisease);
                        _Diseases = diseases;
                    }
                }
                return _Diseases;
            }
        }
    }
}